package com.sizu.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.sizu.entity.TSaleList;
import com.sizu.mapper.TSaleListMapper;
import com.sizu.service.ITSaleListService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 赵玉玺
 * @since 2020-03-16
 */
@Service
public class TSaleListServiceImpl extends ServiceImpl<TSaleListMapper, TSaleList> implements ITSaleListService {

    @Override
    public boolean upTSaleListState(String number) {
        Wrapper<TSaleList> tSaleListWrapper=new EntityWrapper<>();
        tSaleListWrapper.eq("sale_number",number);
        TSaleList tSaleList=new TSaleList();
        tSaleList.setState(2);
        this.baseMapper.update(tSaleList,tSaleListWrapper);
        return true;
    }

    @Override
    public List<TSaleList> getTSaleList() {
        Wrapper<TSaleList> tSaleListWrapper=new EntityWrapper<>();
        tSaleListWrapper.eq("state","1");
        List<TSaleList> tSaleLists = this.baseMapper.selectList(tSaleListWrapper);
        return tSaleLists;
    }
}
